package com.dlc.beijingrfid.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;

import com.dlc.commonlibrary.widget.TitleBar;
import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.adapter.WashPageAdapter;
import com.dlc.beijingrfid.base.BaseActivity;
import com.dlc.beijingrfid.base.Constants;
import com.dlc.beijingrfid.widget.PagerSlidingTabStrip;

import butterknife.BindView;

/**
 * 送洗（租赁）订单
 * Created by YoungeTao on 2017/07/20
 * QQ 2276559259.
 * gmail youngetao@gmail.com
 *
 */
public class WashActivity extends BaseActivity {

    @BindView(R.id.title_bar)
    TitleBar mTitleBar;
    @BindView(R.id.vp_common)
    ViewPager vp_publish;
    @BindView(R.id.tabs)
    PagerSlidingTabStrip tabs;
    private WashPageAdapter adapter;
    private int type;

    @Override
    protected int getLayoutID() {
        return R.layout.activity_wash;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        type = getIntent().getIntExtra("type",0);
        mTitleBar.leftExit(this);
        switch (type){
            case Constants.START_TYPE.WASH_ORDER:
                mTitleBar.setTitle(R.string.wash_order);
                break;
            case Constants.START_TYPE.LEASE_ORDER:
                mTitleBar.setTitle(R.string.lease_order);
                break;
        }
        initViewPage();
    }

    private void initViewPage() {
        adapter = new WashPageAdapter(getSupportFragmentManager(),type);
        vp_publish.setAdapter(adapter);
        tabs.setTextColor(R.color.white);
        tabs.setTextColorResource(R.color.white);
        tabs.setViewPager(vp_publish);
        tabs.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            }

            @Override
            public void onPageSelected(int position) {
            }

            @Override
            public void onPageScrollStateChanged(int state) {
            }
        });
    }
}
